﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for MinicursoMinistrante
/// </summary>
public partial class MinicursoMinistrante
{
    public static List<MinicursoMinistrante> findByIdMinicurso(Guid idMinicurso)
    {
        DataClassesDataContext dc = new DataClassesDataContext();
        return dc.MinicursoMinistrantes.Where(p => p.idMinicurso.Equals(idMinicurso)).ToList();
    }
    public static bool existMinistranteByMiniscurso(Guid idMinicurso)
    {
        DataClassesDataContext dc = new DataClassesDataContext();
        return dc.MinicursoMinistrantes.Any(p => p.idMinicurso.Equals(idMinicurso));
    }
    public static bool excludeMinistranteByMinicurso(Guid idMinicurso)
    {
        try
        {
            DataClassesDataContext dc = new DataClassesDataContext();
            List<MinicursoMinistrante> mm = dc.MinicursoMinistrantes.Where(p => p.idMinicurso.Equals(idMinicurso)).ToList();
            dc.MinicursoMinistrantes.DeleteAllOnSubmit(mm);
            dc.SubmitChanges();
            return true;
        }
        catch (Exception ex)
        {
            return false;
        }
    }
}